// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
// 引入字体图标
import './assets/iconfont/iconfont.css'

// 导入全局样式表
import './assets/css/global.css'

// import './icons' // icon

// 导入高亮 heighlight.js
import Highlight from './utils/highlight'
Vue.use(Highlight)

// 引入 element-ui 样式
import 'element-ui/lib/theme-chalk/index.css'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

// import SvgIcon from '@/components/SvgIcon'
// Vue.use(SvgIcon)

import axios from 'axios'

// 协议
let protocol = window.location.protocol; //http
let host = window.location.host; // 192.168.3.5

// 动态地址
// axios.defaults.baseURL = protocol + "//" + host; // 打包地址

// 配置请求的根路径
axios.defaults.baseURL = 'http://192.168.3.68:8081' // cjx地址

axios.interceptors.request.use(config => {
  config.headers.Authorization = sessionStorage.getItem('satoken')
  config.headers.token = sessionStorage.getItem('satoken')
  config.headers.serialNumber = '1'
  config.headers.set("Access-Control-Allow-Origin", "*") //允许所有来源访同
  config.headers.set("Access-Control-Allow-Method", "POST,GET,PUT");//允许访问的方式 这两行解决跨域 

  // 在最后必须加上 return config 
  return config
})
Vue.prototype.$http = axios

Vue.use(ElementUI)
Vue.use(VueQuillEditor)
//引入删除弹窗 并挂载到Vue原型上
import { box } from "./utils/deleteMessageBox";
Vue.prototype._box = box;


Vue.config.productionTip = false
// 因为icon里面找不到.svg文件  主不在乎,然后 为true的话 就是会找他的子文件,但是true就会报错,直接指定svg文件路径也会报错
const req = require.context('./icons', false, /\.svg$/)
const requireAll = requireContext => requireContext.keys().map(requireContext)
// console.log(requireAll(req));
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
 